﻿<%@ Page Language="C#" %>
<script RunAt="server">
	protected override void OnLoad(EventArgs e) {
		base.OnLoad(e);
		System.Data.DataView dv = new PurchaseBatchesDataSource().SelectEx(int.Parse(Request["BatchID"]));
		object image = dv[0]["BatchImages"];
		if (image != null) {
			Response.ContentType = Dimok.Images.Enums.GetContentType((byte[])image);
			if (Response.ContentType == "application/octet-stream") {
				image = Dimok.ABCPdf.TiffToPDF((byte[])image);
				Response.ContentType = Dimok.Images.Enums.GetContentType((byte[])image);
			}
			Response.Buffer = false;
			//Response.BinaryWrite( Dimok.Documents.PDF.LinearizePdf(image));
			Response.BinaryWrite((byte[])image);
		}
	}
</script>
